<?php


namespace app\common\exception;


use app\common\constants\ReturnCodeConstants;
use app\common\util\Response as ToolsResponse;
use think\Response;
use Throwable;

class DeleteFailException extends BaseException
{
    public static function render($request, Throwable $e): Response
    {
        //整理错误信息，方便日志记录以及发消息警告
        $errMsg = $e->getMessage() === '' ? ReturnCodeConstants::CODE_MESSAGE[ReturnCodeConstants::S_DB_DELETE_FAIL] : $e->getMessage();
        //开发人员错误信息
        $devMsg = self::getDevMsg($errMsg, $request, $e);
        //发送警报

        //返回错误的json消息
        return ToolsResponse::failureJson(ReturnCodeConstants::S_DB_DELETE_FAIL, $e->getMessage());
    }
}